#ifndef __DA215_H_
#define __DA215_H_
#include <stdio.h>
#include <stdint.h>
#include "iic.h"


#define DA215_ADDR  0x27


#define abs(x)          (((x) > 0) ? (x) : (-(x)))

//da217 register add
#define REG_SPI_I2C                 0x00
#define REG_CHIP_ID                 0x01 //
#define REG_ACC_X_LSB               0x02
#define REG_ACC_X_MSB               0x03
#define REG_ACC_Y_LSB               0x04
#define REG_ACC_Y_MSB               0x05
#define REG_ACC_Z_LSB               0x06
#define REG_ACC_Z_MSB               0x07 
#define REG_MOTION_FLAG             0x09 
#define REG_G_RANGE                 0x0f
#define REG_ODR_AXIS                0x10
#define REG_MODE_BW                 0x11
#define REG_SWAP_POLARITY           0x12
#define REG_FIFO_CTRL               0x14
#define REG_INT_SET0                0x15
#define REG_INT_SET1                0x16
#define REG_INT_SET2                0x17
#define REG_INT_MAP1                0x19
#define REG_INT_MAP2                0x1a
#define REG_INT_MAP3                0x1b
#define REG_INT_PIN_CONFIG          0x20
#define REG_INT_LATCH               0x21
#define REG_ACTIVE_DUR              0x27
#define REG_ACTIVE_THRESHOLD        0x28
#define REG_TAP_DURATION            0x2A
#define REG_TAP_THRESHOLD           0x2B
#define REG_ENGINEERING_MODE        0x7f
#define REG_SENS_COMP               0x8c
#define REG_MEMS_OPTION             0x8f
#define REG_CHIP_INFO               0xc0




void da215_init();     // da215 io and module initial
uint8_t da215_register_read(uint8_t addr, uint8_t *data_m, uint8_t len);
uint8_t da215_read_raw_xyz(int16_t *x, int16_t *y, int16_t *z);
void get_da215_data();


#endif
